﻿using System;
using WindowsForms.AOnline.View.Dictionary;
//using System.Threading.Tasks;

namespace WindowsForms.AOnline.Presenter.Dictionary.InventoryItem
{
    public class InventoryItemsPresenter : Presenter<IInventoryItemsView> 
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="CurrenciesPresenter" /> class.
        /// </summary>
        /// <param name="view">The view.</param>
        public InventoryItemsPresenter(IInventoryItemsView view) 
            : base(view)
        {
        }

        /// <summary>
        /// Displays this instance.
        /// </summary>
        public void Display(int page)
        {
            View.InventoryItems = Model.GetInventoryItems(page);
        }

        public int GetPageSize()
        {
            return Model.GetPageSizeInventoryItems();
        }

        public void GetAll()
        {
            View.InventoryItems = Model.GetAllInventoryItems();
        }

        public void DisplayByStock(int itemStockId, int refId, string postDate)
        {
            var postDateCurrent = DateTime.Parse(postDate) + new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); 
            View.InventoryItems = Model.GetInventoryItemListByStock(itemStockId, refId, postDateCurrent);
        }

    }
}
